import vconf from "../../../utils/vconf.js";
const config = vconf("config.yml");

const schema = {
  response: {
    1: {
      type: "object",
      properties: {
        id: { type: "number" },
        name: { type: "string" },
        tel: { type: "string" },
        sex: { type: "string" },
      },
    },
  },
};

export default async function (fastify, opts) {
  fastify.get("/", { schema }, async function (request, reply) {
    const { query } = request;
    // const token = fastify.jwt.sign(request.query, { expiresIn: config.expiresIn })
    // const token = fastify.jwt.sign(request.query, { expiresIn: '1 h' })
    // console.log('token==========>>>>>',token)
    //   const row = await fastify.mysql.query(
    //     'select id,name,tel,sex from user_list limit 5;'
    //   )
    // fastify.set_redis(`api_${fastify.md5(raw.url)}`, row, 60*60*24)
    reply.code(200).send(query);
  });
}
